<?php	

	function sendEmail($sender, $receiver, $subj, $msg)
	{
		require_once '\xampp\htdocs\mail\phpmailer\PHPMailer-master\PHPMailerAutoload.php';
		$mail = new PHPMailer();

		$mail->IsSMTP(); // telling the class to use SMTP
		$mail->SMTPAuth = true; // enable SMTP authentication
		$mail->SMTPSecure = "tls"; // sets tls authentication
		$mail->Host = "smtp.pitt.edu"; // sets Pitt as the SMTP server
		$mail->Port = 587; // set the SMTP port for the Pitt server
		
		$username = "sem156"; // your Pitt username without @pitt.edu ('sem156' or similar)
		$password = ""; // the password for your Pitt account
		
		// echo var_dump($sender, $receiver, $subj, $msg, $username, $password) . "<br/>";
		$mail->Username = $username;
		$mail->Password = $password;

		// Put information into the message
		$mail->addAddress($receiver);
		$mail->SetFrom($sender);
		$mail->Subject = "$subj";
		$mail->Body = "$msg";
		
		// echo 'Everything ok so far' . var_dump($mail);
		if(!$mail->send()) 
		{
			echo 'Message could not be sent.';
			echo 'Mailer Error: ' . $mail->ErrorInfo;
			return false;
		} 
		else 
		{ 
			// echo 'Message has been sent'; 
			return true;
		}
	}
	
	
?>